const containsDuplicate = nums => {
    let arr = [];

    for (let i = 0; i < nums.length; i++) {
        if (arr.indexOf(nums[i]) === -1) {
            arr.push(nums[i])
        }
    }

    console.log(arr);

    if (arr.length != nums.length) {
        return false
    } else {
        return true
    }
}

console.log(containsDuplicate([1, 2, 3, 1]));